<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{$title}</title>
    <meta name="keywords" content="{$title}">
    <meta name="description" content="{$title}">
    <link rel="shortcut icon" href="favicon.ico"> <link href="__STATICADMIN__/css/bootstrap.min.css" rel="stylesheet">
    <link href="__STATICADMIN__/css/font-awesome.min93e3.css" rel="stylesheet">
    <link href="__STATICADMIN__/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__STATICADMIN__/css/animate.min.css" rel="stylesheet">
    <link href="__STATICADMIN__/css/style.min.css" rel="stylesheet">
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <p class="ibox float-e-margins">
            <div class="ibox-title">
                <h2>修改文章分类</h2>
            </div>
            <form method="post" class="form-horizontal" name="save" id="save" action="{:U('edit')}">
                <div class="form-group">
                    <label class="col-sm-2 control-label">所属分类</label>
                    <div class="col-sm-10">
                        <select class="form-control m-b" name="pc" id="pc">
                            <foreach name="tree" item="v" key="k">
                                <option value="{$v.id}" {$v['id']==$category_info['id']?'selected':''}>
                                <?php
                                        for($i = 1;$i < $v['level'];$i++){
                                            echo '------';
                                        }
                                ?>
                                {$v.category}
                                </option>
                            </foreach>
                        </select>
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group has-success">
                    <label class="col-sm-2 control-label">分类名称</label>
                    <div class="col-sm-10">
                        <input type="text" value="{$category_info.category}" name="category" id="category" class="form-control">
                    </div>
                </div>
                <input type="hidden" name="id" value="{$category_info.id}">
                <div class="form-group">
                    <div class="col-sm-4 col-sm-offset-2">
                        <button class="btn btn-primary" id="button" type="submit">修改</button>
                        <a class="btn btn-danger" href="javascript:history.go(-1)"><i class="fa fa-close"></i> 取消</a>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script src="__STATICADMIN__/js/jquery.min.js"></script>
<script src="__STATICADMIN__/js/jquery.form.js"></script>
<script src="__STATICADMIN__/js/common.js"></script>
<script src="__STATIC__/public/layui/lay/dest/layui.all.js"></script>
</body>
<script>
    $(function(){
        $('#save').ajaxForm({
            beforeSubmit:checkForm,
            success: complete,
            dataType: 'json'
        });
        function checkForm() {
            if ($('#category').val() == '') {
                sxshop.error('分类名称不能为空');
                return false;
            }
        }
        function complete(date){
            if(date.state > 0){
                sxshop.error(date.msg);
                return false;
            }else{
                sxshop.success(date.msg,'{:U("index")}');

            }
        }
    })
</script>
</html>